package com.mdz.nc.Controller;


import com.mdz.nc.Entity.Sbyplx;
import com.mdz.nc.Mapper.SbyplxMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 孟德志
 * @since 2020-07-25
 */
@Controller
@RequestMapping("/nc/sbyplx")
public class SbyplxController {

    @Autowired
    private SbyplxMapper sbyplxMapper;

    @ResponseBody
    @RequestMapping("/getsbyplx")
    public List<Sbyplx> getsbyplx(ModelMap map){
        List<Sbyplx> sbyplxes=sbyplxMapper.selectList(null);
        map.put("sbyplxes",sbyplxes);
        return sbyplxes;
    }

    @ResponseBody
    @RequestMapping("/getyplx/{id}")
    public String getyplx(@PathVariable("id") String id, ModelMap map){
        String yplxmc=sbyplxMapper.getyplx(id);
        map.put("yplxmc",yplxmc);
        return yplxmc;
    }
}

